<?php
/*
 * 保养类
 * @package    auto
 * @author     YuNian
 * @copyright  Copyright (c) 2013 ixdcw team
 * @version    $Id: d56ba21ab4c50a31e72b3e7c073d446be3fbe0f6 $
 */

class AutoMaintain {

	private static $_table;
	private static $_tableData;

	private static function _getTable() {
		if (!empty(self::$_table)) {
			return self::$_table;
		} else {
			self::$_table = Table::name(Table::NAME_MAINTENANCE);
			return self::$_table;
		}
	}

	private static function _getTableData() {
		if (!empty(self::$_tableData)) {
			return self::$_tableData;
		} else {
			self::$_tableData = Table::name(Table::NAME_MAINTENANCE_DATA);
			return self::$_tableData;
		}
	}

	/**
	 * 获取保养信息
	 * @param $carid
	 * @return array
	 */
	public static function byCarid($carid) {
		global $db;
		$sql = "SELECT * FROM " . self::_getTable() . " t, " . self::_getTableData() . " d WHERE t.itemid=d.itemid and  t.arcid=$carid";
		return $db->getAll($sql);
	}


}